package com.sos.utils
{
	import flash.utils.getQualifiedClassName;

	public class ClassUtils
	{

		/**
		 * Returns the class name of the given Object without the package path
		 * @param obj
		 * @return 
		 * 
		 */		
		public static function getName(obj:Object):String
		{
			return getPath(obj).split("::")[1];
		}
		
		/**
		 * Returns the class name of the given Object
		 * @param obj
		 * @return 
		 * 
		 */		
		public static function getPath(obj:Object):String
		{
			return getQualifiedClassName(obj);
		}
		
		/**
		 * Check if the given object is an instance of the class  
		 * @param obj
		 * @param className
		 * @return 
		 * 
		 */		
		public static function isClassByName(obj:Object, classPath:String):Boolean
		{
			return getPath(obj).indexOf(classPath) == 0;
		}
		
		/**
		 * Check if the given object is an instance of Vector.<?> class 
		 * @param obj
		 * @return 
		 * 
		 */		
		public static function isVector(obj:Object):Boolean
		{
			return isClassByName(obj, '__AS3__.vec::Vector');
		}
		
	}
}